<?php

declare(strict_types=1);

namespace app\Controller\WebApi\v1;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\Di\Annotation\Inject;
use App\Controller\AbstractController;
use Hyperf\HttpServer\Annotation\Controller;
use Service\CouponService\CouponService;
/**
 * 优惠券服务接口数据
 * @author Luoshumai
 * @Controller(prefix="/webapi/v1/coupon")
 */
class CouponController extends AbstractController
{
    /**
     * Inject()
     * @var CouponService
     */
    protected $couponService;

    /**
     * 领券
     * @RequestMapping(path="getCoupon", methods="post")
     */
    public function getCoupon(RequestInterface $request)
    {
        return $this->couponService->getCoupon(
            (int)$request->input('coupon_id'),
            (int)$request->input('cid'),
            (int)$request->input('mnid'),
            (int)$request->input('mn_sid'),
            (string)$request->input('coupon_code'),
            28327
        );
    }

    /**
     * 我的优惠券
     * @RequestMapping(path="couponList",methods="post")
     */
    public function myCouponList(RequestInterface $request)
    {
        return $this->couponService->couponList(
            (int)$request->input('status'),
            (int)$request->input('page'),
            (int)$request->input('limit'),
            (int)$request->input('cid'),
            (int)$request->input('mnid'),
            (int)$request->input('mn_sid'),
            28327
        );
    }

    /**
     * 优惠券可用的商品
     * @RequestMapping(path="couponGoods",methods="post")
     */
    public function couponGoods(RequestInterface $request)
    {
        return $this->couponService->couponGoods(
            (int)$request->input('coupon_id'),
            (int)$request->input('page'),
            (int)$request->input('limit'),
            (int)$request->input('cid'),
            (int)$request->input('mnid'),
            (int)$request->input('mn_sid'),
            (string)$request->input('key_word'),
            28327
        );
    }

    /**
     * 优惠券详情
     * @RequestMapping(path="couponDetail",methods="post")
     */
    public function couponDetail(RequestInterface $request)
    {
        return $this->couponService->couponDetail(
            (int)$request->input('coupon_id'),
            (int)$request->input('page'),
            (int)$request->input('limit'),
            28327
        );
    }

     /**
     * 优惠券详情
     * @RequestMapping(path="newPeopleCoupon",methods="post")
     */
    public function newPeopleCoupon(RequestInterface $request)
    {
        return $this->couponService->newPeopleCoupon(
            (int)$request->input('cid'),
            (int)$request->input('mn_sid'),
            (int)$request->input('page'),
            (int)$request->input('limit'),
            28327
        );
    }

    /**
     * 黑卡优惠券
     * @RequestMapping(path="vipCouponLists",methods="post")
     */
    public function vipCouponLists(RequestInterface $request)
    {
        return $this->couponService->vipCouponLists(
            (int)$request->input('cid'),
            (int)$request->input('mnid'),
            (int)$request->input('mn_sid'),
            28327
        );
    }

     /**
     * 一键领取新人优惠券
     * @RequestMapping(path="oneGetCoupon",methods="post")
     */
    public function oneGetCoupon(RequestInterface $request)
    {
        return $this->couponService->oneGetCoupon(
            (int)$request->input('cid'),
            (int)$request->input('mnid'),
            (int)$request->input('mn_sid'),
            28327
        );
    }

    /**
     * 店铺优惠券列表
     * @RequestMapping(path="storeCouponList",methods="post")
     */
    public function storeCouponList(RequestInterface $request)
    {
        return $this->couponService->storeCouponList(
            (int)$request->input('cid'),
            (int)$request->input('mnid'),
            (int)$request->input('mn_sid'),
            (int)$request->input('page'),
            (int)$request->input('limit'),
            28327
        );
    }

    /**
     * 获取领取优惠券短信验证码
     * @RequestMapping(path="smsCode",methods="post")
     */
    public function smsCode(RequestInterface $request)
    {
        return $this->couponService->smsCode(
            (int)$request->input('cid'),
            (string)$request->input('mobile'),
            1
        );
    }

    /**
     * 获取领取优惠券短信验证码
     * @RequestMapping(path="getCouponBag",methods="post")
     */
    public function getCouponBag(RequestInterface $request)
    {
        return $this->couponService->smsCode(
            (int)$request->input('cid'),
            (string)$request->input('mobile'),
            2,
            (int)$request->input('bag_id'),
        );
    }

    /**
     * 获取领取优惠券短信验证码
     * @RequestMapping(path="CouponBagStatus",methods="post")
     */
    public function CouponBagStatus(RequestInterface $request)
    {
        return $this->couponService->couponBagStatus(
            (int)$request->input('cid'),
            (int)$request->input('bag_id'),
            2,
        );
    }

}
